#include<iostream>
#include<cstring>
using namespace std;
const int N = 110, M = N * N;
int h[N], e[M], ne[M], idx;
int n;
int q[N * N];
int d[N];
void add(int a, int b)
{
	e[idx] = b;
	ne[idx] = h[a];
	h[a] = idx++;
}
void tuopu_sort()
{
	int tt = -1, hh = 0;
	for (int i = 1; i <= n; i++) {
		if (!d[i]) {
			q[++tt] = i;
		}
	}
	while (hh <= tt) {
		int t = q[hh++];
		for (int i = h[t]; ~i; i = ne[i]) {
			int j = e[i];
			if (--d[j] == 0) {
				q[++tt] = j;
			}
		}
	}
}
int main()
{
	cin >> n;
	memset(h, -1, sizeof(h));
	for (int i = 1; i <= n; i++) {
		int x;
		while (cin >> x, x) {
			add(i, x);
			d[x]++;
		}
	}
	tuopu_sort();
	for (int i = 0; i < n; i++) {
		cout << q[i] << " ";
	}
	return 0;
}